package com.googlecode.wcbunittests.test;


import org.hamcrest.Factory;
import org.hamcrest.Matcher;

import com.googlecode.wcbunittests.test.matchers.ContainsOnly;
import com.googlecode.wcbunittests.test.matchers.IsInstantialbleClassName;
import com.googlecode.wcbunittests.test.matchers.IsValidGxIdentifier;
import com.googlecode.wcbunittests.test.matchers.IsValidWcbId;

/**
 * Defines a set of easily callable Hamcrest matchers specifically tailored for WCB testings.
 * Simple factory methods around the classes in the .matchers subpackage.
 * @since v. 1.0.0
 * @author Freek Wielstra
 *
 */
public class Matchers {
    
    @Factory
    public static <T> Matcher<String> containsOnly(String permittedCharacters) {
        return new ContainsOnly(permittedCharacters);
    }
    
    /**
     * Tests if the given WCB ID is a valid WCB ID, containing only characters a-z.
     * @since v. 1.0.0 1 feb. 2011
     * @param <T>
     * @return
     */
    @Factory
    public static <T> Matcher<String> isValidWcbId() {
        return new IsValidWcbId();
    }
    
    /**
     * Tests if the given identifier contains only lowercase characters a-z, separated by dots.
     * @since v. 1.0.0 1 feb. 2011
     * @param <T>
     * @return
     */
    @Factory
    public static <T> Matcher<String> isValidGxIdentifier() {
        return new IsValidGxIdentifier();
    }
    
    /**
     * Asserts if the given classname is an instantiable classname, i.e. the class defined by the
     * given string can be instantiated on the current JVM.
     * @since v. 1.0.0 1 feb. 2011
     * @param <T>
     * @return
     */
    @Factory
    public static <T> Matcher<String> isInstantiableClassName() {
        return new IsInstantialbleClassName();
    }

}
